<template>
  <div style="width: 100%;">
    <editor v-model="editorContent" />
  </div>
</template>
<script lang="ts" setup>
import { defineAsyncComponent, computed } from 'vue'
import { component } from './editor'
const props = defineProps({
  content: {
    type: String,
    default: ''
  }
})
const emit = defineEmits(['update:content'])

const editorContent = computed({
  get: () => props.content,
  set: (nv) => {
    emit('update:content', nv)
  }
})
const {
  template,
  getComponent
} = component()
getComponent()

const editor = defineAsyncComponent({
  loader: () => import(`./${template.value}/Editor.vue`),
  delay: 200,
  timeout: 3000
})

</script>
